<template>
  <node title="发起人" :is-root="true" :content="content"
        @selected="emit('selected')" @insertNode="type => emit('insertNode', type)"
        placeholder="所有人" :header-bgc="headerBgc" header-icon="el-icon-user-solid"/>
</template>

<script setup>
import Node from './Node.vue'

import {defineProps,ref, defineEmits,reactive, toRefs, nextTick, onMounted,computed,getCurrentInstance,onBeforeUnmount} from 'vue';

import { useStore } from 'vuex'
const store = useStore()
import {useRouter} from 'vue-router'
const router = useRouter()

const { proxy } = getCurrentInstance()

const emit = defineEmits(['insertNode'])

const showError = ref(false);
const errorInfo = ref('');


const props = defineProps({
  config:{
    type: Object,
    default: () => {
      return {}
    }
  }
})

const content = (()=>{
  if (props.config.props.assignedUser.length > 0){
    let texts = []
    props.config.props.assignedUser.forEach(org => texts.push(org.name))
    return String(texts).replaceAll(',', '、')
  } else {
    return '所有人'
  }
})

const headerBgc = (()=>{
  if (store.state.flow.diagramMode === 'viewer') {
    return props.config.props.headerBgc
  } else {
    return '#576a95'
  }
})
</script>

<style scoped>

</style>
